<template>
	<!-- 微信小程序用view代替div -->
	<view class="music-head" :style="{color:color}">
		<view class="music-head-icon" v-if="icon" :class="{ 'music-head-iconBlack' : iconblack }">
			<!-- click事件是pc端的单机事件，但是当这个事件在移动端实现的时候，会出现延迟300ms的现象，所以移动端一般用tap来代替click -->
			<text class="iconfont icon-zuojiantou" @tap='handleToBack'></text>
			|
			<text class="iconfont icon-shouye" @tap="handleToHome"></text>
		</view>
		{{title}}
	</view>
</template>

<script>
	export default {
		name:"musichead",
		props:['title','icon','color','iconblack'],
		data() {
			return {
				
			};
		},
		methods:{
			// uniapp没有vue一样的this.$router路由，它有自己的路由和页面跳转接口
			
			// 返回按钮
			handleToBack(){
				uni.navigateBack()
			},
			// 回到主页按钮
			handleToHome(){
				uni.navigateTo({
					url:'/pages/index/index'
				})
			}
		}
	}
</script>

<style scoped>
	.music-head{
		width: 100%;
		height: 75px;
		font-size: 16px;
		line-height: 80px;
		text-align: center;
		color: black;
		position: relative;
	}
	.music-head-icon{
		position: absolute;
		left: 8px;
		top:26px;
		width: 90px;
		height: 30px;
		background: rgba(0,0,0,0.4);
		color: white;
		line-height: 30px;
		border-radius: 15px;
		display: flex;
		justify-content: space-evenly;
	}
	.music-head-iconBlack{
		color:black;
		background:white;
		border:1px #dddddd solid;
	}
</style>
